<?php
    include('../include/init.php');
    include(ADMINPATH.'/function/function.php');
    
    if(isset($_GET['m']) AND $_GET['m']!=''){
        if(file_exists(ADMINPATH.'/modules/'.$_GET['m'])){
            
            if(file_exists(ADMINPATH.'/modules/'.$_GET['m'])){
                if(isset($_GET['s']) AND $_GET['s']!=''){
                    if(file_exists(ADMINPATH.'/modules/'.$_GET['m'].'/'.$_GET['s'].'.php')){
                        include('modules/'.$_GET['m'].'/'.$_GET['s'].'.php');
                    }else{
                        include('modules/'.$_GET['m'].'/index.php');
                    }
                }else{
                    include('modules/'.$_GET['m'].'/index.php');
                }
            }else{
                if(isset($_SESSION['ADMIN']['USER']) && ($_SESSION['ADMIN']['USER']!='')){
                    include('modules/main/index.php');
                }else{
                    include('modules/system/login.php');
                }
            }
        }else{
            if(isset($_SESSION['ADMIN']['USER']) && ($_SESSION['ADMIN']['USER']!='')){
                include('modules/main/index.php');
            }else{
                include('modules/system/login.php');
            }
        }
    }else{
        if(isset($_SESSION['ADMIN']['USER']) && ($_SESSION['ADMIN']['USER']!='')){
            include('modules/main/index.php');
        }else{
            include('modules/system/login.php');
        }
    }
    
?>